Practical D3.js by Tarek Amr & Rayna Stamboliyska
Author:Tarek Amr & Rayna Stamboliyska
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA
Check Figure 5-3 to see how the labels might look like here.
Figure 5-3.Comparing Brazil’s and Italy’s GDP
When to Use D3
Using SVG tags is easy when you are dealing with simple charts. However, suppose someone asked you to represent the GDPs of the top 20, 50, or 200 economies instead of just four. If you used the previous method, you would have to write 200 lines for 200 rect tags, each with the same x position, height and colors. And then you’d have to do the same for the 200 text labels. And then, just when you’re finished, your client asks you to change the color of the bars from blue to red. That means you have edit the 200 lines of code you just wrote. And what if your client wants a thinner or thicker border? Or what if the client now wants to show only a fraction of the GDPs within the same drawing area? And what if the GDP of those economies differs only minimally, which means the scale you introduced before, based on the top four economies, no longer yields a noticeable difference (see Figure 5-3)? Would you start resizing your canvas and the dimensions of the bars? Clearly, coding charts by hand using SVG has its limitations: it makes it extremely difficult to modify charts dynamically because you cannot easily separate the data from the logical decisions you’ve made up front.
In conclusion, the D3 JavaScript library is designed to help decouple the data and the logic needed to represent the data, hence its name Data-Driven Documents (D3) . D3 also offers you many additional capabilities. Throughout the remaining chapters of this book you will learn about the library’s other capabilities, such as scales, layouts, animations, data handling, and so on.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Brazilian Economy since the Great Financial Crisis of 20072008 by Philip Arestis Carolina Troncoso Baltar & Daniela Magalhães Prates(362441)
International Integration of the Brazilian Economy by Elias C. Grivoyannis(111602)
The Art of Coaching by Elena Aguilar(53657)
Flexible Working by Dale Gemma;(23361)
How to Stop Living Paycheck to Paycheck by Avery Breyer(19835)
Thinking, Fast and Slow by Kahneman Daniel(12532)
The Acquirer's Multiple: How the Billionaire Contrarians of Deep Value Beat the Market by Tobias Carlisle(12429)
The Radium Girls by Kate Moore(12182)
The Art of Thinking Clearly by Rolf Dobelli(10719)
Hit Refresh by Satya Nadella(9259)
The Compound Effect by Darren Hardy(9152)
Tools of Titans by Timothy Ferriss(8594)
Atomic Habits: Tiny Changes, Remarkable Results by James Clear(8520)
Turbulence by E. J. Noyes(8210)
A Court of Wings and Ruin by Sarah J. Maas(8112)
Change Your Questions, Change Your Life by Marilee Adams(7932)
Nudge - Improving Decisions about Health, Wealth, and Happiness by Thaler Sunstein(7854)
How to Be a Bawse: A Guide to Conquering Life by Lilly Singh(7614)
Win Bigly by Scott Adams(7347)